package cn.iocoder.yudao.module.trade.dal.dataobject.fruitcard;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.trade.controller.admin.fruitcard.vo.FruitCardExportReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.fruitcard.vo.FruitCardPageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.giftcard.vo.CardPageReqVO;
import cn.iocoder.yudao.module.trade.dal.mysql.fruitcard.FruitCardDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 水果卡 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface FruitCardMapper extends BaseMapperX<FruitCardDO> {

    default PageResult<FruitCardDO> selectPage(FruitCardPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FruitCardDO>()
                .eqIfPresent(FruitCardDO::getCardType, reqVO.getCardType())
                .eqIfPresent(FruitCardDO::getTimes, reqVO.getTimes())
                .eqIfPresent(FruitCardDO::getPrice, reqVO.getPrice())
                .eqIfPresent(FruitCardDO::getValidMonth, reqVO.getValidMonth())
                .eqIfPresent(FruitCardDO::getFruitType, reqVO.getFruitType())
                .likeIfPresent(FruitCardDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(FruitCardDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FruitCardDO::getId));
    }

    default List<FruitCardDO> selectList(FruitCardExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<FruitCardDO>()
                .eqIfPresent(FruitCardDO::getCardType, reqVO.getCardType())
                .eqIfPresent(FruitCardDO::getTimes, reqVO.getTimes())
                .eqIfPresent(FruitCardDO::getPrice, reqVO.getPrice())
                .eqIfPresent(FruitCardDO::getValidMonth, reqVO.getValidMonth())
                .eqIfPresent(FruitCardDO::getFruitType, reqVO.getFruitType())
                .likeIfPresent(FruitCardDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(FruitCardDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FruitCardDO::getId));
    }

}
